package com.ruoyi.project.domain.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.base.Field;
import io.swagger.annotations.ApiModel;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
@ApiModel("阶段字典配置表")
@TableName(value = "project_allocation_detail ",autoResultMap = true)
public class AllocationDetail extends Field {

    private static final long serialVersionUID = 1L;

    /** id */
    @TableField(fill = FieldFill.INSERT)
    @TableId
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /** id */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long allocationId;

    /** 绩效系数 */
    @Excel(name = "绩效系数")
    private BigDecimal ratio;

    /** 绩效金额 总的 */
    @Excel(name = "绩效金额")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    private BigDecimal money;

    /** 个人绩效金额 */
    @Excel(name = "个人绩效金额")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    private BigDecimal personMoney;

    /** 部门绩效金额 */
    @Excel(name = "部门绩效金额")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    private BigDecimal deptMoney;

    /** 起始日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "起始日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date startDate;

    /** 截止日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "截止日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date endDate;

    /** 质保金 */
    @Excel(name = "质保金")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    private BigDecimal warranty;



    /** 项目id */
    @Excel(name = "项目id")
    private String projectNo;

    //备注
    private String remark;

    //参与人名称
    private String personName;

    //参与人id
    private Long  personId;

    @TableField(exist = false)
    private String type;

    @TableField(exist = false)
    private String isSale;

    //岗位名称
    @TableField(exist = false)
    private String postName;

    //岗位id
    @TableField(exist = false)
    private Long postId;

    //分配的权限 默认禁用  销售负责人给项目经理分配 项目经理给其他人分配
    @TableField(exist = false)
    private boolean oper = false ;


    //是否有多个销售负责人
    @TableField(exist = false)
    private boolean moreSale;

    /** 绩效系数 */
    @Excel(name = "标准岗位绩效系数")
    @TableField(exist = false)
    private BigDecimal parentRatio;

    /** 绩效金额 */
    @Excel(name = "绩效金额")
    @TableField(exist = false)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    private BigDecimal parentMoney;

    /** 备注 */
    @Excel(name = "备注")
    @TableField(exist = false)
    private String parentRemark;


    /** 绩效金额  质保部分的*/
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    @TableField(exist = false)
    private BigDecimal warrantyMoney;



    //当前分配的类型 是扣除了质保金的还是纯质保金
    private String current;

    //审核人  关联配置表  从配置表获取需要哪些岗位的人审核postId（审核的岗位）和审核类型needPerson 是否必须全部审核人同意
    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<Integer> audit;


    //显示行状态颜色
    @TableField(exist = false)
    private String rowStatus = "0";


    //是否已经确认发放 1是2否
    @TableField(exist = false)
    private String confirmRow;

    //是否已经确认发放 1否2是
    private String confirm;

    //发放比例
    private BigDecimal percentage;

    //已发放
    private BigDecimal already;

    //未发放
    private BigDecimal wait;

    //绩效确认日期
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date confirmDate;


    //已发放  部门的
    private BigDecimal deptAlready;

    //未发放  部门的
    private BigDecimal deptWait;

    @TableField(exist = false)
    private Integer projectCount;


    /** 本次发放金额*/
    @Excel(name = "个人绩效本次发放金额")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    @TableField(exist = false)
    private BigDecimal personCurrent;

    /** 本次发放金额*/
    @Excel(name = "部门绩效本次发放金额")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    @TableField(exist = false)
    private BigDecimal deptCurrent;


}